package com.android.memoprendiz.controller;

import java.io.File;

import com.android.memoprendiz.R;
import com.android.memoprendiz.model.Configuration;
import com.android.memoprendiz.model.ConfigurationsDAO;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.util.Log;

public class InicialActivity extends Activity {
	
    public void onResume(){
    	super.onResume();
        
        ConfigurationsDAO CD = new ConfigurationsDAO(this);
        Configuration config = CD.getConfiguration();
        int id = this.getResources().getIdentifier(config.getCaminhoEstilo(), "style",this.getPackageName());
        this.setTheme(id);
    }
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        ConfigurationsDAO CD = new ConfigurationsDAO(this);
        Configuration config = CD.getConfiguration();
        int id = this.getResources().getIdentifier(config.getCaminhoEstilo(), "style",this.getPackageName());
        this.setTheme(id);
        setContentView(R.layout.inicial);
       
        Thread t = new Thread() {
        	@Override
			public void run() {
        		try {
        			Thread.sleep(3000);
        		}
                catch (InterruptedException e) {
        			e.printStackTrace();
        		}
        		finally {
        			startActivity(new Intent(getApplicationContext(), MenuInicialActivity.class));
        			finish();
        		}
        	}
        };
        
        t.start();
    }
}